package com.xyp.mesadmin.sys.service.impl;

import com.xyp.mesadmin.sys.mapper.SysUserMapper;
import com.xyp.mesadmin.sys.service.SysUserService;
import com.xyp.mescommon.entity.sys.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * --- 加油，努力 ---
 *
 * @Author XYP
 * @Date 2024/9/23
 * @Solgne 从想做到能做
 * @Desc
 */
@Service
public class SysUserServiceImpl implements SysUserService {
    @Autowired
    private SysUserMapper sysUserMapper;
    @Override
    public SysUser login(String username, String password) {
        SysUser sysUser = sysUserMapper.selectSysUserByUsername(username);
        if (sysUser == null) {
            throw new RuntimeException("用户名不存在");
        }
        if (!sysUser.getPassword().equals(password)){
            throw new RuntimeException("密码错误");
        }
        return sysUser;
    }
}
